Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v4 React on Rails: redux_store from either view or controller, other fixes #311

Merged
merged 1 commit into from
Mar 15, 2016

Conversation

justin808
Copy link
Member

Review on Reviewable

@justin808 justin808 mentioned this pull request Mar 5, 2016
@justin808 justin808 changed the title Updated README.md and ReactOnRails.js v4 React on Rails: Deprecate redux_store from view, move to controller Mar 6, 2016
throw new Error(`Could not find hydrated store with name '${name}'. ` +
`Hydrated store names include [${storeKeys}].`);
} else {
return;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Linter complains here.

@alex35mil
Copy link
Member

LGTM! We should try it out 👍

@justin808 justin808 force-pushed the new-api-shared-redux-stores branch from 8bb7dec to d36645b Compare March 6, 2016 23:18
@justin808
Copy link
Member Author

CI is failing when I do a fresh git clone, but not in my regular development setup.

@justin808
Copy link
Member Author

It may not be worth deprecating the view based setup, and if so, the version would go to 3.1 rather than 4.0.

@lucke84
Copy link
Contributor

lucke84 commented Mar 10, 2016

Took a quick look, maybe it's worth trying and upgrade node to 5.6.0?

@seoyoochan
Copy link

@justin808 if we only pass props as redux_store("helloWorldStore", @hello_world_props) in controller, without passing them to a react component as <%= react_component("HelloWorldApp", props: @hello_world_props, prerender: true) %>, you will have the following errors..

[SERVER] helloWorldStore.jsx {"name":"Stranger"}
[SERVER] RENDERED HelloWorldApp to dom node with id: HelloWorldApp-react-component-0
[SERVER] HelloWorldAppServer {}
[SERVER] helloWorldStore.jsx {}
[SERVER] Warning: Failed propType: Required prop `name` was not specified in `HelloWorldWidget`. Check the render method of `HelloWorld`.
helloWorldStore.jsx {"name":"Stranger"}
RENDERED HelloWorldApp to dom node with id: HelloWorldApp-react-component-0
HelloWorldAppClient {}
helloWorldStore.jsx {}
Warning: Failed propType: Required prop `name` was not specified in `HelloWorldWidget`. Check the render method of `HelloWorld`.

In both HelloWorldAppServer.jsx and HelloWorldAppClient.jsx,

props becomes empty object if the react component has not been given any props from its Rails view.
if I pass props to react component as well, it works finally.

I followed @jopdeklein jopdeklein's repo by #298

@justin808
Copy link
Member Author

@seoyoochan @lucke84 Thanks. I'm reconsidering removing some deprecations that turn into errors, to keep the version number bump to 3.1.

@justin808 justin808 force-pushed the new-api-shared-redux-stores branch from 7c5375b to 07054c8 Compare March 14, 2016 03:16
@justin808 justin808 changed the title v4 React on Rails: Deprecate redux_store from view, move to controller v4 React on Rails: redux_store from either view or controller, other fixes Mar 14, 2016
@justin808 justin808 force-pushed the new-api-shared-redux-stores branch from b7fe1d1 to 92586ef Compare March 14, 2016 08:20
@justin808
Copy link
Member Author

I'm going to apply this to the https://github.com/shakacode/react-webpack-rails-tutorial and then merge if that goes well. NOTE: There are breaking changes.

Please try this out:

@justin808 justin808 force-pushed the new-api-shared-redux-stores branch 2 times, most recently from 8090e26 to a0451d9 Compare March 15, 2016 09:04
* Updated API of ReactOnRails.js to provide optional param for getStore.
* Added API docs for new controller module and view helper for shared
  redux stores.
* Implement shared stores in controller
* Updated gems and npm modules
* Support Phantom JS 2.x
* Setup hot dev mode for spec/dummy
* Added view helpers for assets
* Converted the spec/dummy app to use css modules
* Many documentation enhancements
* Fix spec failures: incorrect Turbolinks require
  Need to use require_asset
* Remove unused precompile directive
* Enable the use of option --only-failures
* Remove default path for server_bundle.js
* BREAKING CHANGE: If a system was depending on this default, the will
  not get any server rendering. This file must be explicitly set in your
  react_on_rails.rb initializer.
* Fixed the spec bundled assets status checker
* Now knows to exclude the server-bundle.js file in case that is the
  only one there. This happened when one would run the Procfile.hot and
  then you'd have only the server rendering js file.
* Change default driver to selenium for Travis
* Removed validation of Ruby part of Turbolinks
  Turbolinks 5 does not have a Ruby part.
* Don't symlink spec/dummy/client react-on-rails
  This was causing the spec failures.
* Change generators to use app/assets/webpack as the generation
  directory might contain CSS.
* Numerous improvements in the verification that the webpack created
  assets are up to date before running tests.
* Several new configuration options and changes to the configuration:
  # Directory where your generated assets go
  config.generated_assets_dir = File.join(%w(app assets webpack))

  # Define the files for we need to check for webpack compilation when running tests
  config.webpack_generated_files = %w( app-bundle.js vendor-bundle.js server-bundle.js )

* config.server_bundle_js_file no longer uses a path, as it can only
  exist in the generated_assets_dir.
* redux_store view helper now requires the props to be specified as a
  named parameter, an it takes an option `defer` to allow rendering at
  the bottom of the layout.
* Updated README.md and ReactOnRails.js
  * Updated API of ReactOnRails.js to provide optional param for getStore.
  * Added API docs for new controller module and view helper for shared
    redux stores.
@justin808 justin808 force-pushed the new-api-shared-redux-stores branch from a0451d9 to 6976a0b Compare March 15, 2016 09:14
justin808 added a commit that referenced this pull request Mar 15, 2016
v4 React on Rails: redux_store from either view or controller, other fixes
@justin808 justin808 merged commit fa01ef7 into master Mar 15, 2016
@justin808 justin808 deleted the new-api-shared-redux-stores branch March 15, 2016 09:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants